/*****************************************************************************
 * Copyright (C) Stacy Curl. All rights reserved.                            *
 * ------------------------------------------------------------------------- *
 * The software in this package is published under the terms of the BSD      *
 * style license a copy of which has been included with this distribution in *
 * the LICENSE.txt file.                                                     *
 *****************************************************************************/
package picounit.features.signature_factory;


import java.util.Iterator;

public class ConvertingIterator<From, To> implements Iterator<To> {
	private final Iterator<From> from;
	private final Converter<From, To> converter;

	public ConvertingIterator(Iterator<From> from, Converter<From, To> converter) {
		this.from = from;
		this.converter = converter;
	}

	public boolean hasNext() {
		return from.hasNext();
	}

	public To next() {
		return converter.convert(from.next());
	}

	public void remove() {
		from.remove();
	}
}